<html>
<head>
  <title>Evernote Export</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="YXBJ Windows/601568 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="504"/>
<h1>08-Math/Date</h1>
<div>
<table bgcolor="#D4DDE5" border="0">
<tr><td><b>创建时间：</b></td><td><i>2018/4/25 18:39</i></td></tr>
<tr><td><b>更新时间：</b></td><td><i>2020/4/6 22:40</i></td></tr>
<tr><td><b>作者：</b></td><td><i>18081003141@163.com</i></td></tr>
</table>
</div>
<br/>

<div>
<span><div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">数</span><span style="font-size: 12pt;">学运算，比如：三角函数？勾股定理？一元二次方程？</span></div><div><br clear="none"/></div><div><br clear="none"/></div><div><img src="00-笔记_files/黑人问号.jpeg" type="image/jpeg" data-filename="黑人问号.jpeg" style="font-size: 12pt;" width="245"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">问：求页面中两点之间的距离</span></div><div><span style="font-size: 12pt;">问：求时钟指针转动时的坐标</span></div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 16pt;"><b>Math内置对象</b></span></div><div><br clear="none"/></div><div><h2 style="margin: 0px; padding: 0px; border: 0px; font-size: 18px;"><span style="border: 0px; font-size: 18px;"><span style="font-size: 18px; font-family: 微软雅黑; font-weight: normal;">Math 对象属性</span></span></h2><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 180px;"></col><col style="width: 395px;"></col></colgroup><tbody><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: baseline; text-align: left; background-color: rgb(63, 63, 63); border: 1px solid rgb(63, 63, 63); width: 180px; padding: 8px;"><div>属性</div></td><td rowspan="1" style="vertical-align: baseline; text-align: left; background-color: rgb(63, 63, 63); border: 1px solid rgb(63, 63, 63); width: 395px; padding: 8px;"><div>描述</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>Math.E</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回算术常量 e，即自然对数的底数（约等于2.718）。</div></td></tr><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>Math.LN2</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回 2 的自然对数（约等于0.693）。</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>Math.LN10</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回 10 的自然对数（约等于2.302）。</div></td></tr><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>Math.LOG2E</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回以 2 为底的 e 的对数（约等于 1.414）。</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>Math.LOG10E</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回以 10 为底的 e 的对数（约等于0.434）。</div></td></tr><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>Math.PI</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回圆周率（约等于3.14159）。</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>Math.SQRT1_2</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回返回 2 的平方根的倒数（约等于 0.707）。</div></td></tr><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>SQRT1_2.SQRT2</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 395px; padding: 8px;"><div>返回 2 的平方根（约等于 1.414）。</div></td></tr></tbody></table><div><span style="font-size: 18px; font-weight: bold;"><br/></span></div><div><span style="font-size: 18px;">Math 对象方法</span></div></div><div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 180px;"></col><col style="width: 402px;"></col></colgroup><tbody><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: baseline; text-align: left; background-color: rgb(63, 63, 63); border: 1px solid rgb(63, 63, 63); width: 180px; padding: 8px;"><div>方法</div></td><td rowspan="1" style="vertical-align: baseline; text-align: left; background-color: rgb(63, 63, 63); border: 1px solid rgb(63, 63, 63); width: 402px; padding: 8px;"><div>描述</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>abs(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回数的绝对值。</div></td></tr><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>sin(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回数的正弦。</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>cos(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回数的余弦。</div></td></tr><tr><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>tan(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回角的正切。</div></td></tr><tr><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>ceil(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>对数进行上舍入。</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>floor(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>对数进行下舍入。</div></td></tr><tr><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>round(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>把数四舍五入为最接近的整数。</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>max(x,y)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回 x 和 y 中的最高值。</div></td></tr><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>min(x,y)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回 x 和 y 中的最低值。</div></td></tr><tr style="padding: 0px; background-color: #ffffff;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>pow(x,y)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回 x 的 y 次幂。</div></td></tr><tr><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>sqrt(x)</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回数的算术平方根。</div></td></tr><tr style="padding: 0px; background-color: #f5f5f5;"><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 180px; padding: 8px;"><div>random()</div></td><td rowspan="1" style="vertical-align: text-top; border: 1px solid rgb(170, 170, 170); width: 402px; padding: 8px;"><div>返回 0 ~ 1 之间的随机小数，包含0不包含1</div></td></tr></tbody></table><div><br clear="none"/></div></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">Math.random()生成一个从0-1（包含0不包含1）的随机小数</span></div><div><br clear="none"/></div><div><span style="font-size: 16px;">生成 min ~ max （min &lt; max）的随机数公式：</span></div><div><br clear="none"/></div><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div><span style="font-size: 12pt; color: #000000; font-family: 微软雅黑;">    Math.random()*(max - min) + min</span></div></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">利用随机数做一个抽奖程序</span></div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 16pt;"><span style="font-size: 16pt; font-weight: bold;">练习</span></span></div><div><br clear="none"/></div><div><span style="text-indent: 0pt;"><span style="font-size: 12pt;">     编写一个函数，获得一个十六进制的随机颜色的字符串(例如：#20CD4F)</span></span></div><div><br/></div><div><span style="text-indent: 0pt;"><span style="font-size: 12pt;">附加题：</span></span></div><div><span style="text-indent: 0pt;"><span style="font-size: 12pt;">    验证码、rgb色值</span></span></div><div><br clear="none"/></div><div><hr/></div><div><br clear="none"/></div><div><br/></div><div><br/></div><div><br clear="none"/></div><div><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold; font-size: 18pt;">对象</span></span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal;"> </span></div><div style="margin: 0px; padding: 0px; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div style="font-size: medium;"><span style="font-size: 16px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal;">什么是对象？</span></div><div style="font-size: medium;"><div><br clear="none"/></div></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal;">对象的类型是object。</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(249, 249, 249); border: 0px; widows: 1; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">JavaScript 中的所有事物都是对象：字符串、数值、数组、函数...</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(249, 249, 249); font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">javaScript中</span><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(249, 249, 249); font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">万事万物皆对象</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal;">想要有对象怎么办？</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal;">创建对象：（创建两种方式:字面量和new运算符）</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">1.New一个对象出来； </span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><font face="等线" style="font-size: 14pt;">var obj = new Object();</font></span></div><div><font face="等线" style="font-size: 14pt;"><br clear="none"/></font></div><div><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><font face="等线" style="font-size: 14pt;">// <span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);">找到对象了  &gt;&gt;&gt;  第一个想到的就是属性；</span></font></span></div><div><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><font face="等线" style="font-size: 14pt;">// <span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);">给对象添加一个属性；</span></font></span></span></div><div><font face="等线" style="font-size: 14pt;"><br clear="none"/></font></div><div><font face="等线" style="font-size: 14pt;"><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);">obj.bianmei='哇真的变漂亮了'</span><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; color: rgb(51, 51, 51);"> ;</span></font></div><div><span style="font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><font face="等线" style="font-size: 14pt;">obj.say=function(){</font></span></div><div><span style="font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><font face="等线" style="font-size: 14pt;">    <span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);">alert(this.bianmei);</span></font></span></div><div><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><font face="等线" style="font-size: 14pt;">}</font></span></div><div><font face="等线" style="font-size: 14pt;"><br clear="none"/></font></div><div><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; color: rgb(51, 51, 51);"><font face="等线" style="font-size: 14pt;">obj.say();</font></span></div><div style="font-size: medium;"><br/></div></div><div style="font-size: medium;"><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal;">obj的属性可以是一个函数，这个时候也叫方法；</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal;">obj函数内的指针this，指向obj对象本身；</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><span style="font-size: 16px; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: bold;">删除对象的属性</span></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><div style="box-sizing: border-box; padding: 8px; font-family: Monaco, Menlo, Consolas, &quot;Courier New&quot;, monospace; font-size: 12px; color: rgb(51, 51, 51); border-radius: 4px; background-color: rgb(251, 250, 248); border: 1px solid rgba(0, 0, 0, 0.15);-en-codeblock:true;"><div><font face="等线" style="font-size: 14pt;">delete obj.bianmei</font></div></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br/></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br clear="none"/></div></div><div style="margin: 0px; padding: 0px; font-size: medium; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"><div><br/></div></div><div style="margin: 0px; padding: 0px; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><span style="letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font style="font-size: 18pt;"><span style="font-family: &quot;Yu Gothic UI&quot;; font-variant-caps: normal; font-variant-ligatures: normal; font-size: 18pt; font-weight: bold;">javaScript的内置对象：系统提供的对象</span></font></span></div><div><br clear="none"/></div><div><br/></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">1. Object对象        是所有JavaScript对象的超类(基类)</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">2. Array对象          数组对象--定义数组属性和方法</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">3. Boolean对象     布尔对象--布尔值相关</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">4. Date对象           日期对象--日期时间相关</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">5. Error对象           错误对象--处理程序错误</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">6. Function对象     函数对象--定义函数属性和方法</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">7.Math对象            数学对象--各种数学运算工具(不是构造函数)</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">8.Number对象       数字对象--定义数字属性和方法</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">9.RegExp对象        正则表达式对象--定义文本匹配与筛选规则</span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;">10.String对象        字符串对象--定义字符串属性和方法</span></div><div><br clear="none"/></div><div><br/></div><div><span style="font-size: 12pt;">-----------------------------------------------------------------</span></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 16pt;">Date</span><span style="font-size: 16pt;">内置对象</span></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="text-indent: 0pt;"><span style="font-size: 12pt;">日期对象创建</span></span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;"><span style="font-size: 12pt; letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; widows: 2; word-spacing: 0px; font-variant-caps: normal; font-variant-ligatures: normal;">    时间戳是指格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总毫秒数（</span><span style="font-size: 12pt; letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal;">时间戳</span><span style="font-size: 12pt; letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; widows: 2; word-spacing: 0px; font-variant-caps: normal; font-variant-ligatures: normal;">）</span></span></div><div><br clear="none"/></div><div><span style="font-size: 12pt;"><span style="letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-variant-caps: normal; font-variant-ligatures: normal;">var date = new Date();//当前时间的日期对象</span></span></div><div><span style="font-size: 12pt;"><span style="letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-variant-caps: normal; font-variant-ligatures: normal;">var data = new Date(2012,6,10);//2012年7月10号的日期对象</span></span></div><div><span style="font-size: 12pt;"><span style="letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-variant-caps: normal; font-variant-ligatures: normal;"><br/></span></span></div><div><span style="font-size: 12pt;"><span style="letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 12pt; font-variant-caps: normal; font-variant-ligatures: normal;">Date.now()  // 获取当前时间戳，得到一个number</span></span></div><div><br clear="none"/></div><div><br clear="none"/></div><div><span style="font-size: 14pt;"><span style="letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 14pt; font-variant-caps: normal; font-variant-ligatures: normal;">get系列API</span></span></div><div><div><br/></div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 130px;"></col><col style="width: 479px;"></col></colgroup><tbody><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getFullYear() </span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回年</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getMonth()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回月份0--11</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getDate()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回某一天</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getDay()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回星期0-6</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getHours()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回小时</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getMinutes()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回分钟</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getSeconds()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回秒</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">getTime()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 479px; padding: 8px;"><div><span style="font-size: 12pt;">返回1970年1月1日午夜到指定日期（字符串）的毫秒数</span></div></td></tr></tbody></table><div><br clear="none"/></div></div><div><span style="font-size: 12pt;">    </span></div><div><div><span style="font-size: 14pt; letter-spacing: normal; orphans: 2; text-indent: 28px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal;">set系列API</span></div><table style="border-collapse: collapse; min-width: 100%;"><colgroup><col style="width: 130px;"></col><col style="width: 285px;"></col></colgroup><tbody><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">setFullYear()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 285px; padding: 8px;"><div><span style="font-size: 12pt;">设置年份</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">setMonth()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 285px; padding: 8px;"><div><span style="font-size: 12pt;">设置月</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">setDate()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 285px; padding: 8px;"><div><span style="font-size: 12pt;">设置天</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">setHours()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 285px; padding: 8px;"><div><span style="font-size: 12pt;">设置小时</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">setMinutes()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 285px; padding: 8px;"><div><span style="font-size: 12pt;">设置分钟</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">setSeconds()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 285px; padding: 8px;"><div><span style="font-size: 12pt;">设置秒</span></div></td></tr><tr><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 130px; padding: 8px;"><div><span style="font-size: 12pt;">setTime()</span></div></td><td rowspan="1" style="border: 1px solid rgb(204, 204, 204); width: 285px; padding: 8px;"><div><span style="font-size: 12pt;">使用毫秒的形式设置时间对象</span></div></td></tr></tbody></table><div><br clear="none"/></div></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">★注意:</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">1、setDay( 这个真没有!!!!,星期是通过设定日期自动计算的 )</span></div><div><span style="font-size: 12pt;">2、set系列API可以设置比当前范围更精细的时间</span></div><div><span style="font-size: 12pt;">    比如：setFullYear（2012，3，5）  设置日期为2012年4月5号</span></div><div><span style="font-size: 12pt;">              setHours（13，30，0）  设置时间为13:30:00</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">-----------------------------------------------------------------</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">1秒=1000毫秒</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">1分钟=60秒</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">1小时=60分=3600秒</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">1天=24小时=1440分=86400秒</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">实例： setFullYear(year，month，day)    </span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">year：</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">必需，表示年份的四位整数</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">month：</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">可选,介于 0 ~ 11 之间：如果不填，取系统当月</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">-1 为去年的最后一个月</span></div><div><span style="font-size: 12pt;">12 为明年的第一个月</span></div><div><span style="font-size: 12pt;">13 为明年的第二个月</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">date：</span></div><div><br clear="none" style="font-size: 12pt;"/></div><ul><li><div><span style="font-size: 12pt;">可选,表示月中某一天的数值。如果不填，取系统当日</span></div></li></ul><div><br clear="none" style="font-size: 12pt;"/></div><ul><li><div><span style="font-size: 12pt;">用本地时间表示。介于 1 ~ 31 之间：</span></div></li></ul><div><br clear="none" style="font-size: 12pt;"/></div><ul><li><div><span style="font-size: 12pt;">0 为上个月最后一天</span></div></li></ul><div><br clear="none" style="font-size: 12pt;"/></div><ul><li><div><span style="font-size: 12pt;">-1 为上个月最后一天之前的天数</span></div></li></ul><div><br clear="none" style="font-size: 12pt;"/></div><ul><li><div><span style="font-size: 12pt;">如果当月有31天：</span><span style="font-size: 12pt;">32 为下个月的第一天</span></div></li></ul><div><br clear="none" style="font-size: 12pt;"/></div><ul><li><div><span style="font-size: 12pt;">如果当月有30天：</span></div></li></ul><div><br clear="none" style="font-size: 12pt;"/></div><ul><li><div><span style="font-size: 12pt;">32 为下一个月的第二天</span></div></li></ul><div><br clear="none" style="font-size: 12pt;"/></div><div><br clear="none" style="font-size: 12pt;"/></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">例：现在时间：13:11:43</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">var date = new Date(2012, 2, 15, 13, 11, 43);</span></div><div><span style="font-size: 12pt;">2012年3月15日 13:11:43</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">date.setFullYear(2013, 5);</span></div><div><span style="font-size: 12pt;">2013年6月15日 13:11:43</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><br clear="none" style="font-size: 12pt;"/></div><div><span style="font-size: 12pt;">date.setFullYear(2012, 20, 5);</span></div><div><span style="font-size: 12pt;">2013年9月5日 13:11:43</span></div><div><br clear="none" style="font-size: 12pt;"/></div><div><br clear="none"/></div><div><br/></div><div><br/></div><div><span style="font-size: 16pt; font-weight: bold;">练习</span></div><div><br clear="none"/></div><div><span style="text-indent: 0pt;"><span style="font-size: 12pt;">1、计算已经过了元旦多少天了？</span></span></div><div><span style="text-indent: 0pt;"><span style="font-size: 12pt;">1、计算离下一个节假日还有多少天？</span></span></div><div><span style="text-indent: 0pt;"><span style="font-size: 12pt;">3、</span></span><span style="font-size: 12pt;">秒杀活动倒计时</span></div><div><span style="text-indent: 0pt; font-size: 12pt;">4、简易日历</span></div><div><span style="font-size: 12pt;">5、</span><span style="font-size: 12pt;">数码时钟</span><br/></div><div><br clear="none"/></div><div><img src="00-笔记_files/时钟.png" type="image/png" data-filename="时钟.png" style="font-size: 12pt;"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div><div><br clear="none"/></div></div><div><br/></div></span>
</div></body></html> 